package com.ihd.ihardware.view.enter.viewModel;

import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.support.annotation.NonNull;

import com.ihd.ihardware.view.enter.model.LoginRepository;

public class SplashViewModel extends AndroidViewModel {

    private LoginRepository mLoginRepository;

    public SplashViewModel(@NonNull Application application) {
        super(application);
    }

    public void getUserInfo() {
        if (mLoginRepository == null)
            mLoginRepository = new LoginRepository();
        mLoginRepository.getUserInfo();
    }

    public void getBanner() {
        if (mLoginRepository == null)
            mLoginRepository = new LoginRepository();
        mLoginRepository.getBanner();
    }

    @Override
    protected void onCleared() {
        super.onCleared();
        if (null != mLoginRepository) {
            mLoginRepository.onDestroy();
            mLoginRepository = null;
        }
    }
}
